<?php

namespace App\Models\Kms\User;

use App\Models\BaseModel;
use App\Models\Kms\Attendance\AttendanceDailyGatherModel;
use Illuminate\Database\Eloquent\Relations\HasOne;

class KmsUserConfigModel extends BaseModel
{
    protected $table = "kms_user_config";

    protected $fillable = [
        "userId",
        "fieldSwitch",
        "updatedByUid",
        "createdByUid"
    ];

    const  FIELD_SWITCH_ON   = 1;
    const  FIELD_SWITCH_OFF  = 0;
    const  FIELD_SWITCH_TEXT = [
        self::FIELD_SWITCH_ON  => "开启",
        self::FIELD_SWITCH_OFF => "关闭",
    ];

    /**
     * @return HasOne
     */
    public function singleFieldDailyGatherRel(): HasOne
    {
        return $this->hasOne(AttendanceDailyGatherModel::class, "userId", "userId");
    }

    /**
     * @return HasOne
     */
    public function userRel(): HasOne
    {
        return $this->hasOne(KmsUser::class, "rmsUserId", "userId");
    }
}
